const path = require('path')

const Koa = require('koa')
const KoaBody = require('koa-body')
const parameter = require('koa-parameter');


const router = require('../router');

const app = new Koa();

app.use(KoaBody.koaBody({
    multipart: true,
    formidable: {
        uploadDir: path.join(__dirname, '../upload'),
        keepExtensions: true,
    },
    parsedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
}));
app.use(parameter(app));

app.use(router.routes());

module.exports = app
